package com.zhou.common.base.mq.exception;

import com.zhou.common.base.mq.model.ResponseEnum;
import lombok.Data;

@Data
public class BizException extends RuntimeException{

    private Integer code;

    private String messageKey;

    private Object[] args;

    public BizException(Integer code, String messageKey) {
        super(messageKey);
        this.code = code;
        this.messageKey = messageKey;
    }

    public BizException(String messageKey) {
        super(messageKey);
        this.messageKey = messageKey;
    }

    public BizException(String messageKey, Object... args) {
        super(messageKey);
        this.messageKey = messageKey;
        this.args = args;
    }

    public BizException(Integer code, String messageKey, Object... args) {
        super(messageKey);
        this.code = code;
        this.messageKey = messageKey;
        this.args = args;
    }

    public BizException(ResponseEnum responseEnum) {
        this(responseEnum.getCode(), responseEnum.getName());
    }



}
